package com.core.androidlearndemo.plugs;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.core.androidlearndemo.R;
import com.goxueche.plugsibrary.ProxyActivity;

import java.io.IOException;

public class PluginTestActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_plugintest);
        findViewById(R.id.loading_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    AssetUtils.copy(PluginTestActivity.this,"pluginapk.apk","pluginapk.apk");
//                    String apkPath = "";
//                    PluginManager.getInstance().loadApk(apkPath);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });

        findViewById(R.id.jump_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(PluginTestActivity.this, ProxyActivity.class);
                intent.putExtra("className", "com.goxueche.pluginapk.MainActivity");
                startActivity(intent);
            }
        });
    }
}
